//
//  BaseDetailPanel.m
//  AsyncImages
//
//  Created by Matthew on 11-12-27.
//  Copyright 2011年 develop4u.gr. All rights reserved.
//

#import "BaseDetailPanel.h"

#define DETAIL_PAGE_WIDTH 320
#define DETAIL_PAGE_HEIGHT 385

@implementation BaseDetailPanel

@synthesize suffix;
@synthesize theDetailPageHeight;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) 
    {
        // Initialization code
        self.backgroundColor = [UIColor whiteColor];
        theDetailPageHeight = DETAIL_PAGE_HEIGHT;
        theActionSheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"转发到微博" otherButtonTitles:nil, nil];
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

-(void) trigger:(NSString *) detailInfoWebLink
   infoBarTitle:(NSString *) inInfoBarTitle
            suffix:(NSString *) inSuffix
{
    infoTopBar = [[TopBar alloc] initWithFrame:CGRectMake(0, 0, DETAIL_PAGE_WIDTH,65)];
    infoTopBar.suffix = inSuffix;
    [infoTopBar initUI:inInfoBarTitle logoDisplay:FALSE type:1];
    [self addSubview:infoTopBar];
    
    detailPage = [[DetailPage alloc] initWithFrame:CGRectMake(0, infoTopBar.frame.size.height, DETAIL_PAGE_WIDTH,theDetailPageHeight)];
    detailPage.suffix = inSuffix;
    [detailPage configMsg];
    [detailPage setURLPrefixByURL:detailInfoWebLink];
    [self addSubview:detailPage];
}

-(void) triggerByBuildId:(NSString *)inId
{
    [detailPage clean];
    [detailPage triggerByBuildId:inId];
}

-(void) setUpTitle:(NSString *) inTitle
{
    [infoTopBar updateTitle:inTitle];
}

-(void) setURLPrefixByURL:(NSString *)inURL
{
    [detailPage setURLPrefixByURL:inURL];
}

-(void) showSharekit
{
    [theActionSheet showInView:self];
}

-(void) closeShareBtn
{
    if (infoTopBar) 
    {
        [infoTopBar closeShareBtn];
    }
}

-(void) refresh:(NSString *) inId
{
    //[detailPage triggerByURL:inId];
}

- (void)dealloc
{
    [super dealloc];
}

@end
